package com.yanfan.usersmart.user.firemain.data;



import com.yanfan.usersmart.user.firemain.ByteUtil;
import lombok.Data;

/**
 *
 * 用传状态
 *
 * @author TDS
 * @date 2022/08/23
 */
@Data
public class UserStatus {

    private Integer status;

    private String type;

	/**
	 * 设备id
	 */
	private String device_id;

    public UserStatus(String data,String deviceId){
    	this.device_id = deviceId;
        String bit = ByteUtil.buqi2(Integer.toBinaryString(Integer.parseInt(data.substring(4,6),16)));
        if ("1".equals(bit.substring(1,2))){
			type = "监测连接线路故障";
        }else if ("1".equals(bit.substring(2,3))){
			type = "正常";
        }else if ("1".equals(bit.substring(3,4))){
			type = "备电故障";
        }else if ("1".equals(bit.substring(4,5))){
			type = "主电故障";
        }else if ("1".equals(bit.substring(5,6))){
			type = "故障";
        }else if ("1".equals(bit.substring(6,7))){
			type = "火警";
        }else if ("1".equals(bit.substring(7,8))){
			type = "测试状态";
        }else{
			type = "正常";
        }

		status =2;
    }

}
